local skill = fk.CreateSkill{
    name = "lingling__roushenhuzhu",
}
Fk:loadTranslationTable{
    ["lingling__roushenhuzhu"] = "肉神护主",
    [":lingling__roushenhuzhu"] = "当你受到1点伤害后，你摸一张牌。轮次开始时，你可以指定一名其他角色，本轮当其受到伤害后，你可以代替其受到伤害。",
    ["#lingling__roushenhuzhu-choose"] = "肉神护主：选择一名其他角色，本轮其受到伤害时，你可以代替其受到伤害",
    ["@[chara]lingling__roushenhuzhu-round"] = "肉神护主",
    ["#lingling__roushenhuzhu-invoke"] = "肉神护主：是否代替 %dest 受到伤害",
}
skill:addEffect(fk.RoundStart,{
    anim_type = "defensive",
    can_trigger = function(self, event, target, player, data)
        return player:hasSkill(skill.name)
    end,
    on_cost = function(self, event, target, player, data)
        local to = player.room:askToChoosePlayers(player,{
            targets = player.room:getOtherPlayers(player, false),
            min_num = 1,
            max_num = 1,
            prompt = "#lingling__roushenhuzhu-choose",
            skill_name = skill.name,
        })
        if #to > 0 then
            event:setCostData(self, to[1])
            return true
        end
    end,
    on_use = function(self, event, target, player, data)
        player.room:setPlayerMark(player, "@[chara]lingling__roushenhuzhu-round", event:getCostData(self).id)
    end,
})
skill:addEffect(fk.DamageInflicted,{
    is_delay_effect = true,
    anim_type = "support",
    can_trigger = function (self, event, target, player, data)
        return data.to.id == player:getMark("@[chara]lingling__roushenhuzhu-round")
    end,
    on_cost = function (self, event, target, player, data)
        if player.room:askToSkillInvoke(player,{
            skill_name = skill.name,
            prompt = "#lingling__roushenhuzhu-invoke::"..data.to.id
        }) then
            return true  
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        local n = data.damage
        data:preventDamage()
        room:damage{
            from = data.from,
            to = player,
            damage = n,
            damageType = data.damageType,
            skillName = data.skillName,
            chain = data.chain,
            card = data.card,
        }
    end,
})
skill:addEffect(fk.Damaged,{
    can_trigger = function (self, event, target, player, data)
        return target == player and player:hasSkill(skill.name)
    end,
    trigger_times = function (self, event, target, player, data)
        return data.damage
    end,
    on_cost = Util.TrueFunc,
    on_use = function (self, event, target, player, data)
        player:drawCards(1,skill.name)
    end,
})
return skill